import { UserRole } from "./db";

interface StorageInterface {
  jwt: string;
  role: UserRole // 用户权限（学生或者管理员）
}

export class Storage {
  static get<K extends keyof StorageInterface>(key: K): StorageInterface[K] {
    return wx.getStorageSync(key);
  }

  static save<K extends keyof StorageInterface>(key: K, value: StorageInterface[K]) {
    wx.setStorageSync(key, value);
  }
}